<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('core/core')->checklogin('','',true);
	$_SESSION['memberid']=$this->model('member')->checkmember();
	$return['list']=array();
	$return['params']['status']=0;
	set_html('title','申请记录');
	exi($return);
}
/*******op*******/
if($_RQ['op']=='list'){
	$params=array('memberid'=>$_SESSION['memberid'],'uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['status'])){
		$params['status']=intval($_RQ['status']);
		$return['status']=$_RQ['status'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$list=pdo_getslice('jy_51job_job_log',$params,array($pindex,$psize),$total,$fields,'','id desc');	
	if($list){
		foreach($list as &$item){
			$job=pdo_get('jy_51job_job',array('id'=>$item['jobid'],'uniacid'=>$_SESSION['uniacid']));
			$item['price']=$job['price'];
			$item['city']=$job['city'];
			$item['onlinetime']=json_decode($job['onlinetime'],true);
			$item['images']=json_decode($job['images'],true);
			$item['isme']=$item['mid']==$_SESSION['uid'] ? 1 :0;
			$item['baotypetitle']=$this->job_paytype2[$job['paytype']].'结('.$this->job_baotype[$job['baotype']].'版)';
			$item['merch']=pdo_get('jy_51job_merch',array('uniacid'=>$_SESSION['uniacid'],'id'=>$job['merchid']),array('title','pcd','district','logo'));
			$item['merchname']=$item['merch']['title']?:'';
			$item['merch']['logo']=tomedia($item['merch']['logo']);
			$item['xuelititle']=$this->xueli_type2[$job['xueli']];
			$item['sextitle']=$this->sex2[$job['sex']];
			$pcd=json_decode($item['merch']['pcd'],true);
			$item['city']=$job['city']?:$item['merch']['city'];
			$item['city']=$item['city']?:$pcd['city'];
			$item['district']=$item['district']?:$item['merch']['district'];
			$item['district']=$item['district']?:$pcd['district'];
			$item['statustitle']=$this->joblog_status[$item['status']];
			$item['createtime']=date('Y-m-d H:i:s', $item['createtime']);
		}
	}
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='del'){
	if(!$_RQ['id']){
		exi('订单不存在，请重新选择订单','error');
	}
	pdo_delete('jy_51job_job_log',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_RQ['id']));
	exi('删除成功','','/job_log/');
}
